<template>
  <!--插入一个商品-->
  <a style="text-decoration:none"
     href="https://item.taobao.com/item.htm?id=538201259150" data-platform="taobao" class="mw-editor">
    <div
      style="display: flex;flex-direction: row;align-items:center;justify-content: space-between;width:3.25rem;background-color: #F5F5F5;border-radius: 0.1rem;padding:0.1rem;">
      <!--商品图片-->
      <img style="border-radius: 0.04rem;object-fit:cover;height:0.72rem;width:0.72rem;margin-right:0.1rem;"
           src="https://img.alicdn.com/bao/uploaded/i1/3688925907/O1CN01iC6wkC1tVS6BXk1W1_!!0-item_pic.jpg_360x360xzq90s150.jpg_.webp"/>
      <div
        style=" height:0.72rem;width:1.99rem;margin-right:0.2rem; display: flex;flex-direction: column;justify-content: space-between">
        <!--商品标题-->
        <div
          style="font-size:0.15rem;line-height:0.23rem;color:#333333;  overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;">
          MUID翻转充电化妆镜台灯美观与实用合一
        </div>
        <div style="display: flex;flex-direction: row;align-items: center">
          <div style="color:#ED3D5D;font-size: 0.1rem;line-height:1">￥</div>
          <div style="color:#ED3D5D;font-size: 0.18rem;margin-right:0.04rem;line-height:1">239</div>        <!--商品价格-->
          <div style="color:#999999;font-size: 0.11rem;line-height:1">天猫</div>        <!--商品平台-->
        </div>
      </div>
      <img src="https://wt-box.worktile.com/thumb/1240d105-5935-4b63-828b-387048e89559_160x160.png"
           style="object-fit:cover;height:0.24rem;width:0.24rem;"/>
    </div>
  </a>


</template>

<script>
  import {mapModules, mapRules} from 'vuet'

  export default {
    mixins: [
      mapModules({data: 'test'}),
      mapRules({store: [{path: 'test'}], once: [{path: 'test'}]})
//      mapRules({once: [{ path: 'test' }]})
    ],
    data() {
      return {
        touchStart: 0,
        downFreshDistance: -100,
        left: 85,
        right: 85,
        bottom: 0,
        lbratio: 2,
        rbratio: 4,
        jishu: true,
        des: "下拉刷新",
        shenbottom: 0,
        leftlist: [],
        leftlistpx: 185,
        rightlist: [],
        rightlistpx: 185,
      }
    },
    methods: {
      panStart(e) {
        e.preventDefault();
        this.touchStart = e.center.y;

      },
      panMove(e) {
        e.preventDefault();
        this.downFreshDistance = e.center.y - this.touchStart - 100;
        this.left = (e.center.y - this.touchStart + 85) / 1.2;
        this.right = (e.center.y - this.touchStart + 85) / 1.2;
        this.bottom = e.center.y - this.touchStart;
        if (this.downFreshDistance < 0) {
          this.des = "下拉刷新"
        } else {
          this.des = "释放刷新"
        }
      },
      panEnd(e) {
        e.preventDefault();
        this.changeState()
        this.des = "正在刷新"

      },
      changeState() {
        var that = this
        setTimeout(function () {
          debugger
          if (that.jishu) {
            that.jishu = false;
            that.lbratio = 2
            that.rbratio = 4
          } else {
            that.jishu = true;
            that.lbratio = 4
            that.rbratio = 2
          }
          that.shenbottom = that.shenbottom - 10
          that.leftlistpx = that.leftlistpx - 10
          that.leftlist.push("1")
          that.rightlistpx = that.rightlistpx - 10
          that.rightlist.unshift("1")
//         that.leftlist.push("1")
          that.changeState()
        }, 200);

      }
    },
    beforeCreate() {
      console.log("beforeCreate")
//      console.log(this.data.message)
    },
    created() {
      console.log("created")
      console.log(this.data.message)
    },
    beforeMount() {
      console.log("beforeMount")
      console.log(this.data.message)
    },
    mounted() {
      console.log("mounted")
      console.log(this.data.message)
    },
    beforeUpdate() {
      console.log("beforeUpdate")
      console.log(this.data.message)
    },
    updated() {
      console.log("updated")
      console.log(this.data.message)
    },
    activated() {
      console.log("activated")
      console.log(this.data.message)
    },
    deactivated() {
      console.log("deactivated")
      console.log(this.data.message)
    },
    beforeDestroy() {
      console.log("beforeDestroy")
      console.log(this.data.message)
    },
    destroyed() {
      console.log("destroyed")
      console.log(this.data.message)
    },
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
